import wxpay from "./wechat";
import alipay from "./alipay";

// 统一支付入口
// Promise 处理支付结果, callPayStatus 标注支付状态, resolve 表示支付成功
const pay = async (paytType, params) => {
    switch (paytType) {
        case paytType == "WECHAT": //微信
            return new Promise((resolve, reject) => {
                wxpay(params).then((res) => {
                    resolve(res)
                }).catch((res) => {
                    reject(res)
                })
            })
            break;
        case paytType == "ALIPAY": //支付宝
            return new Promise((resolve, reject) => {
                alipay(params).then((res) => {
                    resolve(res)
                }).catch((res) => {
                    reject(res)
                })
            })
            break;
        case paytType == "BALANCE": //余额
            break;
        case paytType == "CASH": //现金
            break;
        default:
            break;
    }
};

export default pay;
